<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog_detail.css">

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <link rel="stylesheet" href="editor.md/css/editormd.min.css">
    <script src="editor.md/lib/marked.min.js"></script>
    <script src="editor.md/lib/prettify.min.js"></script>
    <script src="editor.md/editormd.js"></script>

</head>
<body>
    <!-- 导航栏. nav 是 导航 这个词的缩写 -->
    <div class="nav">
        <!-- logo -->
        <img src="image/logo2.jpg" alt="">
        <div class="title">zzzyh的博客系统</div>
        <!-- 只是一个空白, 用来把后面的链接挤过去 -->
        <!-- 这是一个简单粗暴的写法~~ -->
        <div class="spacer"></div>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <!-- 这里的地址回头再说 -->
        <a href="logout">注销</a>
    </div>
    <!-- 页面的主体部分 -->
    <div class="container">
        <!-- 左侧信息 -->
        <div class="container-left">
            <!-- 这个 div 表示整个用户信息的区域 -->
            <div class="card">
                <!-- 用户的头像 -->
                <img src="image/kun.jpg" alt="">
                <!-- 用户名 -->
                <h3></h3>
                <!-- github 地址 -->
               <!-- <a href="https://www.github.com">github 地址</a>-->
                <!-- 统计信息 -->
                <!--<div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>-->
                <!--<div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>-->
            </div>
        </div>

        <!-- 右侧信息 -->
        <div class="container-right">
            <h3></h3>
            <div class="date"></div>
            <div class="content" id="content"></div>
        </div>
    </div>

    <script src="js/app.js"></script>

    <script>
        function findById(){
            $.ajax({
                url:'findById'+location.search,
                type:'get',
                success:function(blog){
                    let Htitle = document.querySelector('.container-right h3');
                    Htitle.innerHTML=blog.title;
                    
                    let blogDate = document.querySelector('.date');
                    blogDate.innerHTML=blog.postTime;

                    // let blogDesc = document.querySelector('.content');
                    // blogDesc.innerHTML=blog.content;
                    editormd.markdownToHTML('content',{markdown:blog.content});
                }
            });
        };
        findById();
        isLogin();

        function getAuthor(){
            $.ajax({
                url:'findAuthor'+location.search,
                type:'get',
                success:function(body){
                    let h3 = document.querySelector('.card h3');
                    h3.innerHTML=body.username;
                }
            });
        };
        getAuthor();
    </script>

</body>
</html>